home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
funcom 2000 Presskit
/
000721_1312 (fun.com).iso
/
funcom.dir
/
00022_Script_Slider Button behavior
< prev
next >
Wrap
Text File
|
2000-07-20
|
9KB
|
268 lines
-- Slider Button behavior
-----------------------------------------------------------
-- This behavior constrains the motion of a button along a
-- vertical or horizontal track to simulate a sliding
-- button. The button outputs a value between 0 and 100
-- depending on its position.
--
-- You attach this behavior to a slider sprite.
--
-- David Benman 11/97
-----------------------------------------------------------
-- pCurrentSprite - This behavior's sprite number
-- pSliderName - The slider's cast member name. This
-- behavior uses the name to uniquely identify its messages
-- to other behaviors.
-- pTrackOrientation - The direction of the track,
-- vertical or horizontal
-- pTrackSprite - The track's sprite number
-- pTrackLength - The length in pixel's of the track
-- pTrackLowerLimit - The stage location of the lower limit
-- of the track and the slider's motion
-- pLastClicked - The last sprite clicked
property pCurrentSprite, pSliderName, pTrackOrientation, pTrackSprite, pTrackLength, pTrackLowerLimit, pLastClicked
-- This handler sets the limits for the indicator's
-- movement on the screen
on beginSprite me
-- Determines the number and member name of the
-- behavior's sprite
set pCurrentSprite to the spriteNum of me
set currentMember to the member of sprite pCurrentSprite
set pSliderName to the name of member currentMember
-- Sets the track sprite to be the sprite in the score
-- directly above the behavior's sprite
set pTrackSprite to pCurrentSprite - 1
-- Creates a frame of reference for the slider including
-- its orientation, length and its lower limit of
-- movement.
set trackWidth to the width of sprite pTrackSprite
set trackHeight to the height of sprite pTrackSprite
if trackWidth > trackHeight then
set pTrackOrientation to #horizontal
set pTrackLength to trackWidth
set pTrackLowerLimit to the left of sprite pTrackSprite
else
set pTrackOrientation to #vertical
set pTrackLength to trackHeight
set pTrackLowerLimit to the top of sprite pTrackSprite
end if
set pLastClicked to 0
end
-- This handler indicates you clicked the behavior's
-- sprite.
on mouseDown me
set pLastClicked to the spriteNum of me
end
-- This handler indicates you have released the behavior's
-- sprite.
on mouseUp me
set pLastClicked to 0
end
-- This handler indicates you have released the behavior's
-- sprite.
on mouseUpOutside me
set pLastClicked to 0
end
-- This handler continuously moves the slider to match the
-- mouse's position when you drag the slider.
on prepareFrame me
-- Move the slider when you hold down the mouse button
-- and the slider is the last item you clicked.
if the mouseDown AND pLastClicked = pCurrentSprite then
if pTrackOrientation = #horizontal then
slideButton(me, the mouseH)
else
slideButton(me, the mouseV)
end if
end if
end
-- This handler moves the slider and sends a message
-- to all the sprites in the frame.
on slideButton me, newLoc
global employee
set currentSprite to the spriteNum of me
-- Moves the slider to a new location limited by
-- the dimensions of the track
if pTrackOrientation = #vertical then
set newLoc to constrainV(pTrackSprite, newLoc)
set the locV of sprite currentSprite to newLoc
else
set newLoc to constrainH(pTrackSprite, newLoc)
set the locH of sprite currentSprite to newLoc
end if
-- Creates a value between 0 and 100 representing the
-- slider's new position
set relativePosition to float(newLoc - pTrackLowerLimit)
set ratio to relativePosition/pTrackLength * 100
--creates employee track
set employee to integer(ratio*1.2)
repeat with i = 110 to (employee+110)
set the visible of sprite (i) to 1
end repeat
repeat with i = (employee+110) to 240
set the visible of sprite (i) to 0
end repeat
-- --tells wich games where published
-- if employee<12 then
-- put "1993" into member ("┼r")
-- put "None" into member ("Spill")
-- end if
-- if employee>12 and employee < 27 then
-- put "1994" into member ("┼r")
-- put "Daze Before Christmas and A Dinosaurs Tale" into member ("Spill")
-- end if
-- if employee>27 and employee < 43 then
-- put "1995" into member ("┼r")
-- put "Casper, Dragonheart, Fatal Fury, Nightmare Circus, Pocahontas and Samurai Shodown " into member ("Spill")
-- end if
-- if employee>43 and employee < 59 then
-- put "1996" into member ("┼r")
-- put "NBA Hangtime, Impact Racing and Wintergold " into member ("Spill")
-- end if
-- if employee>59 and employee < 75 then
-- put "1997" into member ("┼r")
-- put "Deadly Skies" into member ("Spill")
-- end if
-- if employee>75 and employee < 90 then
-- put "1998" into member ("┼r")
-- put "None" into member ("Spill")
-- end if
-- if employee>90 and employee < 106 then
-- put "1999" into member ("┼r")
-- put "Championship Motocross, Speed Freaks and The Longest Journey (No, Se, Fr)" into member ("Spill")
-- end if
-- if employee>106 and employee < 120 then
-- put "2000" into member ("┼r")
-- put "The Longest Journey (Eng, Ger)" into member ("Spill")
-- end if
--tells wich games where published
if employee<12 then
put "1993" into member ("┼r")
set the visible of sprite 55 to 1
set the visible of sprite 56 to 0
set the visible of sprite 57 to 0
set the visible of sprite 58 to 0
set the visible of sprite 59 to 0
set the visible of sprite 60 to 0
set the visible of sprite 61 to 0
set the visible of sprite 62 to 0
end if
if employee>12 and employee < 27 then
put "1994" into member ("┼r")
set the visible of sprite 55 to 0
set the visible of sprite 56 to 1
set the visible of sprite 57 to 0
set the visible of sprite 58 to 0
set the visible of sprite 59 to 0
set the visible of sprite 60 to 0
set the visible of sprite 61 to 0
set the visible of sprite 62 to 0
end if
if employee>27 and employee < 43 then
put "1995" into member ("┼r")
set the visible of sprite 55 to 0
set the visible of sprite 56 to 0
set the visible of sprite 57 to 1
set the visible of sprite 58 to 0
set the visible of sprite 59 to 0
set the visible of sprite 60 to 0
set the visible of sprite 61 to 0
set the visible of sprite 62 to 0
end if
if employee>43 and employee < 59 then
put "1996" into member ("┼r")
set the visible of sprite 55 to 0
set the visible of sprite 56 to 0
set the visible of sprite 57 to 0
set the visible of sprite 58 to 1
set the visible of sprite 59 to 0
set the visible of sprite 60 to 0
set the visible of sprite 61 to 0
set the visible of sprite 62 to 0
end if
if employee>59 and employee < 75 then
put "1997" into member ("┼r")
set the visible of sprite 55 to 0
set the visible of sprite 56 to 0
set the visible of sprite 57 to 0
set the visible of sprite 58 to 0
set the visible of sprite 59 to 1
set the visible of sprite 60 to 0
set the visible of sprite 61 to 0
set the visible of sprite 62 to 0
end if
if employee>75 and employee < 90 then
put "1998" into member ("┼r")
set the visible of sprite 55 to 0
set the visible of sprite 56 to 0
set the visible of sprite 57 to 0
set the visible of sprite 58 to 0
set the visible of sprite 59 to 0
set the visible of sprite 60 to 1
set the visible of sprite 61 to 0
set the visible of sprite 62 to 0
end if
if employee>90 and employee < 106 then
put "1999" into member ("┼r")
set the visible of sprite 55 to 0
set the visible of sprite 56 to 0
set the visible of sprite 57 to 0
set the visible of sprite 58 to 0
set the visible of sprite 59 to 0
set the visible of sprite 60 to 0
set the visible of sprite 61 to 1
set the visible of sprite 62 to 0
end if
if employee>106 and employee < 120 then
put "2000" into member ("┼r")
set the visible of sprite 55 to 0
set the visible of sprite 56 to 0
set the visible of sprite 57 to 0
set the visible of sprite 58 to 0
set the visible of sprite 59 to 0
set the visible of sprite 60 to 0
set the visible of sprite 61 to 0
set the visible of sprite 62 to 1
end if
-- Tells the other sprites the slider has moved and
-- its new position in the form of a ratio
sendAllSprites(#sliderMove, pSliderName, ratio)
end